import { View } from "../../../mvc/core/View";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { EffectManager } from "../../manager/EffectManager";
import { UIIconEvent } from "../uiIconBtn/UIIconEvent";
//class BlessHintIconFu
    
    export  class BlessHintIconFu extends View
    {
        constructor()
        {
            super();
            this._blessQueue = [];
            this.buttonMode = true;
            this.createChildren();
            this.addListeners();
            return;
        }

        /* internal  */createChildren(): void
        {
            var loc1=GlobalClass.getScaleBitmap(ImagesConst.FriendBlessFu_hintIcon);
            this.addChild(loc1);
            this._numLabel = new Object /* flash.text.TextField */();
            this._numLabel.selectable = false;
            this._numLabel.filters = [FilterConst.glowFilter];
            this._numLabel.width = loc1.width;
            this._numLabel.height = 10;
            this._numLabel.autoSize = flash.text.TextFieldAutoSize.RIGHT;
            this._numLabel.y = loc1.height - 14;
            addChild(this._numLabel);
            return;
        }

        /* internal  */addListeners(): void
        {
            this.addEventListener(flash.events.MouseEvent.CLICK, this.hintIcon_click);
            return;
        }

        public showIcon(arg1: Array<any>): void
        {
            var loc1=null;
            var loc2=0;
            var loc3=arg1;
            for(loc1 of loc3) 
            {
                this._blessQueue.push(loc1);
            }
            this._numLabel.text = String(this._blessQueue.length);
            this._numLabel.setTextFormat(new GTextFormat(FontUtil.songtiName, 10, 16777215));
            this.show();
            return;
        }

        /* internal  */hintIcon_click(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FriendBless_ShowBlessesList, this._blessQueue.slice()));
            this._blessQueue = [];
            if (this.parent) 
            {
                this.parent.removeChild(this);
                EffectManager.glowFilterUnReg(this);
                this.dispatchEvent(new UIIconEvent(UIIconEvent.RemoveIcon));
            }
            return;
        }

        /* internal */ /* var */_numLabel: Object /* flash.text.TextField */;

        /* internal */ /* var */_blessQueue: Array<any>;
    }
